<?php
/*
 * Login Ajax Call File
 * 
 * This file will handle all the Ajax calls from the index Controller
 * 
 * @author : Jason Meulenhoff
 * @mail : mail@kacangboi.com
 * @web : http://kacangboi.com
 * @copyright : KacangNetworks 2010
 * 
 */

require '../../config.php';

if(isset($_POST['username']) && isset($_POST['password']))
{
	if(!maxConnections())
	{
		if(empty($_POST['username']) || empty($_POST['password']))		
			echo '<img src="../images/error.png"> Please fill in all the fields';
			// Log error ?
		else
		{
			$login = new login();
			$login->login(mysql_real_escape_string($_POST['username']),mysql_real_escape_string($_POST['password']));
		}
	}
	else
		echo ' <img src="../images/error.png"> Connection Limit Exeeded';
}
else
	header("Location: ../controllers/error.controller.php");
	exit;
?>